using UnityEngine;

public class PlayerTriggerControl : MonoBehaviour
{
    private PlayerStateSkill _playerSkill;
    private RotatingStateBall _rotatingStateBall;
    private AnimsControl _anims;

    private void OnEnable()
    {
        _playerSkill=transform.parent.GetComponent<PlayerStateSkill>();
        _rotatingStateBall=transform.parent.GetComponent<RotatingStateBall>();
        _anims=GetComponent<AnimsControl>();
    }

    private void OnTriggerStay(Collider other)
    {
        if (other.CompareTag("Enemy"))
        {
            _anims.PlayAnim("PlayerOutLine");
        }
    }

    private void OnTriggerEnter(Collider other)
    {
        if (other.CompareTag("PropPlayerSpeed"))
        {
            _playerSkill.AddSpeed(20);
            _anims.PlayAnim("PlayerPropOutLine");
        }
        else if (other.CompareTag("PropRotatingBallSpeed"))
        {
            _rotatingStateBall.AddRotationSpeed(25);
            _anims.PlayAnim("PlayerPropOutLine");
        }
        else if (other.CompareTag("PropRotatingBallRadius"))
        {
            _rotatingStateBall.AddRadius(10);
            _anims.PlayAnim("PlayerPropOutLine");
        }
        else if (other.CompareTag("PropRotatingBallCount"))
        {
            _rotatingStateBall.AddBall(1);
            _anims.PlayAnim("PlayerPropOutLine");
        }
        else if (other.CompareTag("GridSkill"))
        {
            _anims.PlayAnim("PlayerOutLine");
        }
    }
}
